home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group00b.txt
/
000172_icon-group-sender_Mon Dec 18 09:24:39 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2001-01-03
|
2KB
Return-Path: <icon-group-sender>
Received: (from root@localhost)
by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id eBIGNQY01007
for icon-group-addresses; Mon, 18 Dec 2000 09:23:26 -0700 (MST)
Message-Id: <200012181623.eBIGNQY01007@baskerville.CS.Arizona.EDU>
Date: Fri, 15 Dec 2000 17:26:13 -0700
From: Steve Wampler <swampler@noao.edu>
To: John Sampson <jsampson@indexes.u-net.com>
Cc: icon-group@cs.arizona.edu
Subject: Re: Stepping
Content-Disposition: inline
User-Agent: Mutt/1.1.9i
Errors-To: icon-group-errors@cs.arizona.edu
Status: RO
Content-Length: 1424
On Fri, Dec 15, 2000 at 08:12:26PM -0000, John Sampson wrote:
> It would be useful to be able to step through an Icon program or set
> break-points in some simple way. I would have thought
>
> dummy := read()
>
> would be useful, and indeed it does step, but dummy remains null so one
> cannot use it to leave the program at will. If dummy acquired a value from
> read(), as the book leads me to expect, I could write
>
> if dummy == "q" then stop
>
> I don't understand why dummy is null - is cessation of keyboard input deemed
> to be EOF, thus causing the procedure to fail?
>
> Regards
>
> _John Sampson_
>
>
Try this instead:
read() | stop("Aborted on user command")
now an EOF character will terminate the program and an ENTER will allow the
program to continue.
In fact, make it a procedure:
procedure pauseForUser()
writes("Enter EOF character to abort program, ENTER to continue: ")
input := read() | stop("Terminated by user.")
#
# Now you can put any special processing here (say to turn tracing
# on or off, or print a "stack" dump, or whatever.)!
#
return input
end
However, dummy := read() sure should assign a value to dummy if you've
typed anything other than EOF. Are you sure you're not confusing
null with an empty string (what you'll see if you just press ENTER)?
Hope this helps!
Steve
--
Steve Wampler- SOLIS Project, National Solar Observatory
swampler@noao.edu